<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Waybill extends Model
{
    use HasFactory;

    protected $primaryKey = 'id';

    protected $fillable = ['order_no', 'express_no', 'goods_name', 'goods_bn', 'part_bn', 'goods_num', 'consignee_name', 'consignee_address', 'supplier_name', 'seller_name', 'order_amount', 'declare_status', 'status', 'platform_delivery_status', 'warehouse_delivery_status', 'clearance_type', 'goods_price', 'cost_amount', 'profit_amount', 'created_at', 'updated_at'];

    protected $appends = [];

    protected $casts = [
        'created_at'   => 'datetime:Y-m-d H:i:s',
        'updated_at'   => 'datetime:Y-m-d H:i:s',
    ];

    public function goods()
    {
        return $this->hasOne(Goods::class, 'goods_bn', 'goods_bn');
    }
}
